// fast4j - Fast & Agile Service Tools for Java
// Copyright (C) 2007 Alexandre ROMAN
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

// $Id: ApplicationCreatorComparator.java 71 2007-04-12 22:22:11Z alexandre.roman $

package fast4j.ace;

import java.util.Comparator;

/**
 * {@link Comparator} implementation for sorting {@link ApplicationCreator}
 * against their identifier.
 * @author alexandre.roman
 */
class ApplicationCreatorComparator implements Comparator<ApplicationCreator> {
    public int compare(ApplicationCreator o1, ApplicationCreator o2) {
        if (o1 == o2) {
            return 0;
        }
        if (o1 == null) {
            return 1;
        }
        if (o2 == null) {
            return -1;
        }
        return o1.getId().compareTo(o2.getId());
    }
}
